package windowFactoryPackage;

import javax.swing.*;

public abstract class WindowGenerator extends JFrame {
//----------------------------------------------------
//Factory class to generate multiple window subclasses
//----------------------------------------------------
	
	//Generate SearchWindow when Search Button is pressed
	public static void generateSearchWindow(){
		JFrame frame = new SearchWindow();
		if(tester.UserIsLoggedIn){
			SearchWindow.jtfUserName.setVisible(false);
			SearchWindow.jpfPassword.setVisible(false);
			SearchWindow.jbtCreateUser.setVisible(false);
			SearchWindow.jbtLogin.setText("Log Out");
			frame.setTitle("Welcome " + tester.userNameLogin + "!");
		} else
			frame.setTitle("Welcome Guest");
		frame.setSize(875, 400);
		frame.setLocationRelativeTo(null);
	    frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	    frame.setVisible(true);
	    frame.setResizable(false);
	}
	
	//Generate InformationWindow when *Custom* ViewButton is pressed
	public static void generateInformationWindowFromCustom(int position){
		JFrame frame = new InformationWindow();
		frame.setTitle("Search Window: " + position);
		frame.setSize(850, 400);
		frame.setLocationRelativeTo(null);
	    frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	    frame.setVisible(true);
	    frame.setResizable(false);
	}
	
	//Generate DownloadWindow when *Custom* DownloadButton is pressed
	public static void generateDownloadWindowFromCustom(int position){
		JFrame frame = new DownloadWindow();
		frame.setTitle("Download Window: " + position);
		frame.pack();
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);
	}
	
	//Generate DownloadWindow when *Non-Custom* DownloadButton is pressed
	public static void generateDownloadWindow(){
		JFrame frame = new DownloadWindow();
		frame.setTitle("Download Window");
		frame.pack();
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);
	}
	
	//Generate SourceCodeWindow when SourceCodeButton is pressed
	public static void generateSourceCodeWindow(){
		JFrame frame = new SourceCodeWindow();
		frame.setTitle("Source Code");
		frame.setSize(600,500);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);
	}
	
	//Generate LiscencesWindow when LiscenceButton is pressed
	public static void generateLiscencesWindow(){
		JFrame frame = new LiscencesWindow();
		frame.setTitle("Liscencing Agreements");
		frame.setSize(600, 500);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);
	}
	
	//Generate PreviousPurchasesWindow when ViewPurchasesButton is pressed
	public static void generatePreviousPurchasesWindow(){
		JFrame frame = new PreviousPurchasesWindow();
		frame.setTitle("Previous User Purchases");
		frame.setSize(550, 400);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);
	}
	
	//Generate PreviousDownloadsWindow when ViewDownloadsButton is pressed
	public static void generatePreviousDownloadsWindow(){
		JFrame frame = new PreviousDownloadsWindow();
		frame.setTitle("Previous User Downloads");
		frame.setSize(550, 400);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);
	}
	
	//Generate UserWindow when *Custom* ViewUserButton is pressed
	public static void generateUserWindow(){
		JFrame frame = new UserWindow();
		frame.setTitle("User Information");
		frame.setSize(550, 275);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);
	}
	
	//Generate VersionsWindow when DeveloperInfoButton is pressed
	public static void generateDeveloperWindow(){
		JFrame frame = new DeveloperWindow();
		frame.setTitle("Developer Information");
		frame.setSize(550, 225);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);
	}
	
	//Generate ReviewsWindow when ReviewButton is pressed
	public static void generateProgramReviewWindow(){
		JFrame frame = new ReviewWindow();
		frame.setTitle("Reviews");
		frame.setSize(600,500);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);
	}
	
	//Generate UserReveiwsWindow when ReviewButton is pressed
	public static void generateUserReviewWindow(){
		JFrame frame = new UserReviewWindow();
		frame.setTitle("Reviews");
		frame.setSize(600,500);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);		
	}
	
	//Generate DeveloperProgramWindow when ViewPrograms button is pressed
	public static void generateDeveloperProgramWindow(){
		JFrame frame = new DeveloperProgramWindow();
		frame.setTitle("Developer Programs");
		frame.setSize(850, 375);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setVisible(true);
		frame.setResizable(false);
	}
	
	//Generate WriteProgramWindow when WriteReview button is pressed
	public static void generateWriteReviewWindow(){
		JFrame frame = new WriteReviewWindow();
		frame.setTitle("Write Review");
		frame.setVisible(true);
		frame.setResizable(false);
		frame.setLocationRelativeTo(null);
		frame.setSize(500, 400);
	}
}
